﻿using System;
using System.Data;
using Microsoft.SqlServer.Types;
using MyFloridaHouse.DataAccess.DTO;

namespace MyFloridaHouse.DataAccess.Extensions
{
    public static class SQLRegionDTODataContract
    {
        public static SQLRegionDTO DataContract(IDataReader rdr)
        {
            var newItem = new SQLRegionDTO
                          	{
                          		regionID = (int) rdr["regionID"],
                          		centerLngX = Convert.ToDouble(rdr["centerLngX"]),
                          		centerLatY = Convert.ToDouble(rdr["centerLatY"]),
                                mapGeom = (SqlGeometry)(rdr["mapGeom"])
                          	};
            return(newItem);
        }
    }
}
